import { AddressList } from './addresslist.js'
import { Person } from './person.js'

console.log('当前通讯录数据：', AddressList.queryAll())

const zhangsan = new Person('张三', '翻斗花园001号', '001')
const lisi = new Person('李四', '翻斗花园002号', '002')
const wangwu = new Person('王五', '翻斗花园003号', '003')

AddressList.add(zhangsan)
AddressList.add(lisi)
AddressList.add(wangwu)

console.log('增加', zhangsan, lisi, wangwu)

console.log('当前通讯录数据：', AddressList.queryAll())
console.log('查询id为1的：', AddressList.query(1))

AddressList.update({ ...lisi, name: '李四狗' })
console.log('更新lisi的')
console.log('当前通讯录数据：', AddressList.queryAll())

AddressList.delete(1)
console.log('删除id为1的')
console.log('当前通讯录数据：', AddressList.queryAll())
